package com.ld.caodan.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.ld.caodan.activity.R;
import com.ld.caodan.util.StringUtils;

/**
 * Activity Title
 *
 * @author 刘笛
 * 2012-8-17  下午04:08:21
 *
 */
public class TitleBar extends FrameLayout {

	TextView title;
	
	public TitleBar(Context context, AttributeSet attrs) {
		super(context, attrs);
		View view = LayoutInflater.from(context).inflate(R.layout.topbar, this);
		title = (TextView) view.findViewById(R.id.topbar_title);
		title.setVisibility(View.VISIBLE);
		TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.titleBar);
		String buttonValue = array.getString(R.styleable.titleBar_button_text);
		String titleValue = array.getString(R.styleable.titleBar_title_text);
		int visibleStatus = array.getInt(R.styleable.titleBar_button_visible,View.VISIBLE);
		if(StringUtils.isNotBlank(titleValue)){
			title.setText(titleValue);
		}
		array.recycle();
	}


	public TextView getTitle() {
		return title;
	}

}
